.section .data
	err:
		.string "INITCONTACT"
.equ DEAFULT_SZ,3  #默认3个大小
.equ PERSON_SIZE,76
.section .text
.global init
.type init,@function
init:
	nop
	push %rbp
	mov %rsp,%rbp
	subq $16,%rsp
#在栈上开辟空间	
	mov %rdi,-8(%rbp)
	mov -8(%rbp),%r12 #注意这里一定要给被调用者保存寄存器，否则可能会被malloc函数修改导致错误
	mov $PERSON_SIZE,%rax #每个人占76字节
	imulq $DEAFULT_SZ,%rax
	movq %rax,%rdi
	movq $0,%rax
	call malloc
	test %rax,%rax
	je 1f
	movq %rax,(%r12)
#初始化通讯录容量和大小
	movl $3,8(%r12)
	movl $0,12(%r12)	
#从文件中加载通讯录信息到内存
	mov %r12,%rdi	
	call LoadContact
	leaveq
	retq
1:
	mov $err,%rdi
	call perror
	mov $0,%rdi
	mov $60,%rax
	syscall
